package com.itheima;
import java.util.ArrayList;
import java.util.Collections;

import java.util.List;
/**
 * @ProjectName: ybxy6
 * @Titile: CollectionsDemo
 * @Author: Chilemey
 * @Description: TODO
 */
public class CollectionsDemo {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        Collections.addAll(list,"张三","李四","王五","赵六");
        list.forEach(System.out::println);
        System.out.println("--------------------------");

        //打乱集合顺序
        Collections.shuffle(list);
        list.forEach(System.out::println);
        test1();
    }

    public static void test1(){
        List<Integer> list = new ArrayList<>();
        Collections.addAll(list,1,2,3,4,5,6,7,8,9,10);
        Collections.sort(list);
        list.forEach(System.out::println);
        System.out.println("-------------倒序排序-------------");
        Collections.sort(list,((o1, o2) -> {
            return o2-o1;
        }));
        list.forEach(System.out::println);
        System.out.println("--------------将学生按年龄升序排序---------");
        List<Student> list1=new ArrayList<>();
        Collections.synchronizedList(list);

    }
}